﻿using System;
using System.Collections.Generic;
using ContractManager.Entity;
using Speed.Data;

namespace ContractManager.BLL.Business
{
    public static class ClsAttachedDocuments
    {
        public static List<AttachedDocuments> SelectAll()
        {
            using (var db = Sys.NewDb())
            {
                return Data.Base.AttachedDocuments.Select(db);
            }
            
        }

        public static void Insert(AttachedDocuments capital)
        {
            using (var db = Sys.NewDb())
            {
                db.Insert<AttachedDocuments>(capital, EnumSaveMode.Requery);
            }
            
        }

        public static void Update(AttachedDocuments capital)
        {
            using (var db = Sys.NewDb())
            {
                db.Update<AttachedDocuments>(capital);
            }
            
        }

        public static AttachedDocuments SelectByPk(Int32 attDocId)
        {
            using (var db = Sys.NewDb())
            {
                return db.SelectSingle<AttachedDocuments>(string.Format("AttDocId={0}", attDocId));
            }
            
        }

        public static int DeleteByPk(Int32 attDocId)
        {
            using (var db = Sys.NewDb())
            {
                return db.Delete<AttachedDocuments>(string.Format("AttDocId={0}", attDocId));
            }
            
        }
    }
}
